﻿using System;
using System.Windows.Data;
using System.Windows;

namespace Skyper.Data {
	public class VisibilityConverter : IValueConverter {
		#region Public
		public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) {
			if (value is Boolean) {
				Boolean obj = (Boolean)value;

				return (obj ? Visibility.Visible : Visibility.Collapsed);
			}
			if (value is String) {
				String message = value as String;
				if (String.IsNullOrEmpty(message)) {
					return Visibility.Collapsed;
				}
				return (message.Length > 0 ? Visibility.Visible : Visibility.Collapsed);
			}
			return Visibility.Collapsed;
		}
		public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) {
			throw new NotImplementedException();
		}
		#endregion
	}
}
